package cn.classTest.mall.service.impl;

import cn.classTest.mall.domain.Warehouse;
import cn.classTest.mall.mapper.WarehouseMapper;
import cn.classTest.mall.query.QueryObject;
import cn.classTest.mall.service.WarehouseService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WarehouseServiceImpl implements WarehouseService {
    @Autowired
    private WarehouseMapper warehouseMapper;



    @Override
    public Warehouse selectOne(Long id) {
        return warehouseMapper.selectOne(id);
    }

    @Override
    public List<Warehouse> selectAll() {
        return warehouseMapper.selectAll();
    }

    @Override
    public PageInfo<Warehouse> query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Warehouse> warehouses = warehouseMapper.selectAll();

        PageInfo<Warehouse> pageInfo = new PageInfo<>(warehouses);

        return pageInfo;
    }
}
